var express=require('express')
var router=express.Router()
var path=require('path')

var fs=require('fs')
var multer=require('multer')//上传图片插件导入

var upload=multer({dest:'upload/'})

// 单图上传
router.post('/upload',upload.single('file'),(req,res,next)=>{
    res.send({ret_code:'0'})
})

router.get('/forms',(req,res,next)=>{
    console.log(req.query.fild)
    // console.log(__dirname)
    var form=fs.writeFileSync('../upload',req.query.fild,(e)=>{
        if(e)return console.log(e)
    })
    console.log(form)
    res.send(form)
})
module.exports=router

